﻿Public Class FrmRecapAjoutDep

#Region "champs"
    Dim position As Integer
    Dim idInt As Integer
    Dim idCli As Integer
    Dim n As Decimal
    Dim v As Decimal
    Public estPlus As Boolean
    Dim idTrav As String
    Dim idTrav2 As String
    Dim qte1, qte2, qte3, qte4, qte5, qte6, qte7, qte8 As Integer
    Dim pr1, pr2, pr3, pr4, pr5, pr6, pr7, pr8, res1, res2, resF As Decimal
    Dim qte9, qte10, qte11, qte12, qte13, qte14, qte15, qte16 As Integer
    Dim pr9, pr10, pr11, pr12, pr13, pr14, pr15, pr16 As Decimal
    Dim macnx As New PPE3.ClassMySqlConnect("853339_depanneur", "071064")
    Dim nbchamps As Integer = 0
    Dim estPlus2 As Boolean
    Public create As Boolean
#End Region

    Private Sub FrmRecapAjoutDep_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        FrmTravauxEffectues.Close()
    End Sub

    Private Sub FrmRecapitulatif_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.MdiParent = FrmStart
        Me.Top = 0
        Me.Left = 0
        If create = False Then
            TextBoxIdIntervention.Text = FrmDepEnCours.lblIdIntervention.Text
            TextBoxIdClient.Text = FrmDepEnCours.lblidClient.Text
        Else
            TextBoxIdClient.Text = FrmAjoutDep.TextBoxIdClient.Text
            TextBoxIdIntervention.Text = FrmAjoutDep.TextBoxIdIntervention.Text

        End If


        macnx.Se_Connecter_MySqlServer()
        DataGridViewCacher.DataSource = Nothing
        DataGridViewCacher2.DataSource = Nothing
        DataGridViewCacher3.DataSource = Nothing
        macnx.viderVue("int")
        macnx.viderVue("date")
        macnx.viderVue("cli")



        DataGridViewCacher.DataSource = macnx.Executer_Requete_Select("SELECT * FROM intervention WHERE IdIntervention = '" & TextBoxIdIntervention.Text & "' ", "int")
        DataGridViewCacher2.DataSource = macnx.Executer_Requete_Select("SELECT * FROM date WHERE IdIntervention = '" & TextBoxIdIntervention.Text & "' ", "date")
        DataGridViewCacher3.DataSource = macnx.Executer_Requete_Select("SELECT * FROM client WHERE IdClient = '" & TextBoxIdClient.Text & "' ", "cli")
        macnx.viderVue("TravEff")
        DataGridViewTravail.DataSource = macnx.Executer_Requete_Select("SELECT * FROM travauxeffectues WHERE IdIntervention = '" & TextBoxIdIntervention.Text & "' ", "TravEff")
        'RafraichirInfo()
        macnx.Se_Deconnecter_MySqlServer()
        If DataGridViewTravail.RowCount - 1 <> 0 Then
            Dim i As Integer = 0
            While i < DataGridViewTravail.RowCount - 1
                Dim libell As String = DataGridViewTravail.Rows(i).Cells(1).Value.ToString()
                Dim qte As Integer = CInt(DataGridViewTravail.Rows(i).Cells(2).Value.ToString())
                Dim pr As String = DataGridViewTravail.Rows(i).Cells(4).Value.ToString()
                Dim trav As Boolean = DataGridViewTravail.Rows(i).Cells(5).Value

                If trav = True Then
                    ExistantTrav(libell, qte, pr)
                Else
                    ExistantNoTrav(libell, qte, pr)
                End If
                i = i + 1
            End While



        End If


        Rafraichir()
        FrmAjoutDep.Close()
        estPlus = True
    End Sub

    Public Sub ExistantTrav(t As String, q As Integer, p As String)

        If lbl1.Text = "" Then
            lbl1.Text = t
            lbl101.Text = q.ToString
            lbl102.Text = p
            lbl1.Visible = True
            lbl101.Visible = True
            lbl102.Visible = True
            Visible = True

        ElseIf Text <> "" And lbl2.Text = "" Then
            lbl2.Text = t
            lbl201.Text = q.ToString
            lbl202.Text = p
            lbl2.Visible = True
            lbl201.Visible = True
            lbl202.Visible = True

        ElseIf lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text = "" Then
            lbl3.Text = t
            lbl301.Text = q.ToString
            lbl302.Text = p
            lbl3.Visible = True
            lbl301.Visible = True
            lbl302.Visible = True

        ElseIf lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text <> "" And lbl4.Text = "" Then
            lbl4.Text = t
            lbl401.Text = q.ToString
            lbl402.Text = p
            lbl4.Visible = True
            lbl401.Visible = True
            lbl402.Visible = True

        ElseIf lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text <> "" And lbl4.Text <> "" And lbl5.Text = "" Then
            lbl5.Text = t
            lbl501.Text = q.ToString
            lbl502.Text = p
            lbl5.Visible = True
            lbl501.Visible = True
            lbl502.Visible = True

        ElseIf lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text <> "" And lbl4.Text <> "" And lbl5.Text = "" And lbl6.Text = "" Then
            lbl6.Text = t
            lbl601.Text = p.ToString
            lbl602.Text = p
            lbl6.Visible = True
            lbl601.Visible = True
            lbl602.Visible = True

        ElseIf lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text <> "" And lbl4.Text <> "" And lbl5.Text <> "" And lbl6.Text <> "" And lbl7.Text = "" Then
            lbl7.Text = t
            lbl701.Text = q.ToString
            lbl702.Text = p
            lbl7.Visible = True
            lbl701.Visible = True
            lbl702.Visible = True

        ElseIf lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text <> "" And lbl4.Text <> "" And lbl5.Text <> "" And lbl6.Text <> "" And lbl7.Text <> "" And lbl8.Text = "" Then
            lbl8.Text = t
            lbl801.Text = q.ToString
            lbl802.Text = p
            lbl8.Visible = True
            lbl801.Visible = True
            lbl802.Visible = True

        End If
    End Sub

    Public Sub ExistantNoTrav(t As String, q As Integer, p As String)

        If lbl9.Text = "" Then
            lbl9.Text = t
            lbl91.Text = q.ToString
            lbl92.Text = p
            lbl9.Visible = True
            lbl91.Visible = True
            lbl92.Visible = True

        ElseIf lbl9.Text <> "" And lbl10.Text = "" Then
            lbl10.Text = t
            lbl1001.Text = q.ToString
            lbl1002.Text = p
            lbl10.Visible = True
            lbl1001.Visible = True
            lbl1002.Visible = True
        ElseIf lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text = "" Then
            lbl11.Text = t
            lbl111.Text = q.ToString
            lbl112.Text = p
            lbl11.Visible = True
            lbl111.Visible = True
            lbl112.Visible = True

        ElseIf lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text <> "" And lbl12.Text = "" Then
            lbl12.Text = t
            lbl121.Text = q.ToString
            lbl122.Text = p
            lbl12.Visible = True
            lbl121.Visible = True
            lbl122.Visible = True


        ElseIf lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text <> "" And lbl12.Text <> "" And lbl13.Text = "" Then
            lbl13.Text = t
            lbl131.Text = q.ToString
            lbl132.Text = p
            lbl13.Visible = True
            lbl131.Visible = True
            lbl132.Visible = True


        ElseIf lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text <> "" And lbl12.Text <> "" And lbl13.Text <> "" And lbl14.Text = "" Then
            lbl14.Text = t
            lbl141.Text = q.ToString
            lbl142.Text = p
            lbl14.Visible = True
            lbl141.Visible = True
            lbl142.Visible = True


        ElseIf lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text <> "" And lbl12.Text <> "" And lbl13.Text <> "" And lbl14.Text <> "" And lbl15.Text = "" Then
            lbl15.Text = t
            lbl151.Text = q.ToString
            lbl152.Text = p
            lbl15.Visible = True
            lbl151.Visible = True
            lbl152.Visible = True

        ElseIf lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text <> "" And lbl12.Text <> "" And lbl13.Text <> "" And lbl14.Text <> "" And lbl15.Text <> "" And lbl16.Text = "" Then
            lbl16.Text = t
            lbl161.Text = q.ToString
            lbl162.Text = p
            lbl16.Visible = True
            lbl161.Visible = True

        End If
    End Sub

    Public Sub Rafraichir()
        Try
            lblIdInt.Text = TextBoxIdIntervention.Text

            LblNom.Text = DataGridViewCacher3.Rows(0).Cells(1).Value.ToString
            LblPrenom.Text = DataGridViewCacher3.Rows(0).Cells(2).Value.ToString
            lblAdresse.Text = DataGridViewCacher3.Rows(0).Cells(3).Value.ToString
            lblCp.Text = DataGridViewCacher3.Rows(0).Cells(4).Value.ToString
            LblVille.Text = DataGridViewCacher3.Rows(0).Cells(5).Value.ToString
            LblTelPort.Text = DataGridViewCacher3.Rows(0).Cells(6).Value.ToString
            LblTelFixe.Text = DataGridViewCacher3.Rows(0).Cells(7).Value.ToString
            lblEmail.Text = DataGridViewCacher3.Rows(0).Cells(8).Value.ToString
            lblRenCompAdresse.Text = DataGridViewCacher3.Rows(0).Cells(9).Value.ToString

            TextBoxTypeInt.Text = DataGridViewCacher.Rows(0).Cells(1).Value.ToString
            TextBoxTypePC.Text = DataGridViewCacher.Rows(0).Cells(2).Value.ToString
            TextBoxLieu.Text = DataGridViewCacher.Rows(0).Cells(3).Value.ToString
            TextBoxPb.Text = DataGridViewCacher.Rows(0).Cells(4).Value.ToString
            TextBoxMateriel.Text = DataGridViewCacher.Rows(0).Cells(5).Value.ToString
            TextBoxTravaux.Text = DataGridViewCacher.Rows(0).Cells(6).Value.ToString

            DateTimePickRecept.Text = DataGridViewCacher2.Rows(0).Cells(0).Value.ToString
            DateTimeDebInt.Text = DataGridViewCacher2.Rows(0).Cells(1).Value.ToString
            DateTimeFin.Text = DataGridViewCacher2.Rows(0).Cells(2).Value.ToString
            DateTimeLiv.Text = DataGridViewCacher2.Rows(0).Cells(3).Value.ToString

            If TextBoxTypeInt.Text = "depannage" Then
                RadioButtonDepannage.Checked = True
            ElseIf TextBoxTypeInt.Text = "formation" Then
                RadioButtonFormation.Checked = True
            ElseIf TextBoxTypeInt.Text = "vente" Then
                RadioButtonVente.Checked = True
            End If

            If TextBoxTypePC.Text = "fixe" Then
                RadioButtonFixe.Checked = True
            ElseIf TextBoxTypePC.Text = "portable" Then
                RadioButtonPortable.Checked = True
            Else
                TextBoxAutre.Text = TextBoxTypePC.Text
            End If

            If TextBoxLieu.Text = "Domicile & Atelier" Then
                RadioButtonDomAtel.Checked = True
            ElseIf TextBoxLieu.Text = "domicile" Then
                RadioButtonDomicile.Checked = True
            ElseIf TextBoxLieu.Text = "atelier" Then
                RadioButtonAtelier.Checked = True
            End If


        Catch ex As InvalidCastException
            MessageBox.Show(ex.Message)
        End Try


    End Sub
    'Public Sub RafraichirInfo()
    '    Dim donnees As New Data.DataTable
    '    donnees = macnx.Executer_Requete_Select("SELECT TexteInfo FROM InfoFormulaire where NumeroInfo = 1 ")
    '    nbchamps = donnees.Rows.Count - 1
    '    TextBoxInfo.Text = RemplaceSlashApostrophes(macnx.GetChamp_DataTable(donnees, position, 0))
    '    donnees = macnx.Executer_Requete_Select("SELECT TexteInfo FROM InfoFormulaire where NumeroInfo = 2")
    '    LabelInfo.Text = RemplaceSlashApostrophes(macnx.GetChamp_DataTable(donnees, position, 0))

    'End Sub

#Region "Fonction"
    Public Function RemplaceApostrophesSlash(ByRef unechaine As String) As String
        Dim ch As String
        ch = unechaine.Replace("'", "/")
        Return ch
    End Function


    Public Function RemplaceSlashApostrophes(ByRef unechaine As String) As String
        Dim ch As String
        ch = unechaine.Replace("/", "'")
        Return ch
    End Function

    Public Function RemplaceSlashApostrophesDataTable(ByRef lesdonnees As DataTable)
        Dim nblignes As Integer
        Dim nbcolonnes As Integer
        Dim test As String = ""
        nblignes = lesdonnees.Rows.Count
        nbcolonnes = lesdonnees.Columns.Count
        Dim i, j As Integer
        For i = 0 To nblignes - 1
            For j = 0 To nbcolonnes - 1
                'Attention le replace ne s'applique qu'aux type String : utilisation de la classe de base Object :
                If Object.ReferenceEquals(lesdonnees.Rows(i).Item(j).GetType(), test.GetType()) Then
                    lesdonnees.Rows(i).Item(j) = RemplaceSlashApostrophes(lesdonnees.Rows(i).Item(j))
                End If
            Next
        Next
        Return lesdonnees
    End Function
#End Region

    Private Sub BtnFermer_Click(sender As System.Object, e As System.EventArgs)
        Close()
    End Sub


    Private Sub btnImprimer_Click(sender As System.Object, e As System.EventArgs) Handles btnImprimer.Click
        btnImprimer.Visible = False
        Me.PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)
        btnImprimer.Visible = True
    End Sub

    Private Sub lbl702_Click(sender As System.Object, e As System.EventArgs) Handles lbl702.Click

    End Sub

    Private Sub btnCalcul_Click(sender As System.Object, e As System.EventArgs) Handles btnCalcul.Click

        If lbl1.Text <> "" And lbl2.Text = "" Then
            TextBoxRes1.Text = qte1 * pr1
        End If
        If lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text = "" Then
            TextBoxRes1.Text = qte1 * pr1 + qte2 * pr2
        End If
        If lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text <> "" And lbl4.Text = "" Then
            TextBoxRes1.Text = qte1 * pr1 + qte2 * pr2 + qte3 * pr3
        End If
        If lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text <> "" And lbl4.Text <> "" And lbl5.Text = "" Then
            TextBoxRes1.Text = qte1 * pr1 + qte2 * pr2 + qte3 * pr3 + qte4 * pr4
        End If
        If lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text <> "" And lbl4.Text <> "" And lbl5.Text <> "" And lbl6.Text = "" Then
            TextBoxRes1.Text = qte1 * pr1 + qte2 * pr2 + qte3 * pr3 + qte4 * pr4 + qte5 * pr5
        End If
        If lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text <> "" And lbl4.Text <> "" And lbl5.Text <> "" And lbl6.Text <> "" And lbl7.Text = "" Then
            TextBoxRes1.Text = qte1 * pr1 + qte2 * pr2 + qte3 * pr3 + qte4 * pr4 + qte5 * pr5 + qte6 * pr6
        End If
        If lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text <> "" And lbl4.Text <> "" And lbl5.Text <> "" And lbl6.Text <> "" And lbl7.Text <> "" And lbl8.Text = "" Then
            TextBoxRes1.Text = qte1 * pr1 + qte2 * pr2 + qte3 * pr3 + qte4 * pr4 + qte5 * pr5 + qte6 * pr6 + qte7 * pr7
        End If
        If lbl1.Text <> "" And lbl2.Text <> "" And lbl3.Text <> "" And lbl4.Text <> "" And lbl5.Text <> "" And lbl6.Text <> "" And lbl7.Text <> "" And lbl8.Text <> "" Then
            TextBoxRes1.Text = qte1 * pr1 + qte2 * pr2 + qte3 * pr3 + qte4 * pr4 + qte5 * pr5 + qte6 * pr6 + qte7 * pr7 + qte8 * pr8
        End If

        If lbl9.Text <> "" And lbl10.Text = "" Then
            TextBoxRes2.Text = qte9 * pr9
        End If
        If lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text = "" Then
            TextBoxRes2.Text = qte9 * pr9 + qte10 * pr10
        End If
        If lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text <> "" And lbl12.Text = "" Then
            TextBoxRes2.Text = qte9 * pr9 + qte10 * pr10 + qte11 * pr11
        End If
        If lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text <> "" And lbl12.Text <> "" And lbl13.Text = "" Then
            TextBoxRes2.Text = qte9 * pr9 + qte10 * pr10 + qte11 * pr11 + qte12 * pr12
        End If
        If lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text <> "" And lbl12.Text <> "" And lbl13.Text <> "" And lbl14.Text = "" Then
            TextBoxRes2.Text = qte9 * pr9 + qte10 * pr10 + qte11 * pr11 + qte12 * pr12 + qte13 * pr13
        End If
        If lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text <> "" And lbl12.Text <> "" And lbl13.Text <> "" And lbl14.Text <> "" And lbl15.Text = "" Then
            TextBoxRes2.Text = qte9 * pr9 + qte10 * pr10 + qte11 * pr11 + qte12 * pr12 + qte13 * pr13 + qte14 * pr14
        End If
        If lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text <> "" And lbl12.Text <> "" And lbl13.Text <> "" And lbl14.Text <> "" And lbl15.Text <> "" And lbl16.Text = "" Then
            TextBoxRes2.Text = qte9 * pr9 + qte10 * pr10 + qte11 * pr11 + qte12 * pr12 + qte13 * pr13 + qte14 * pr14 + qte15 * pr15
        End If
        If lbl9.Text <> "" And lbl10.Text <> "" And lbl11.Text <> "" And lbl12.Text <> "" And lbl13.Text <> "" And lbl14.Text <> "" And lbl15.Text <> "" And lbl16.Text = "" Then
            TextBoxRes2.Text = qte9 * pr9 + qte10 * pr10 + qte11 * pr11 + qte12 * pr12 + qte13 * pr13 + qte14 * pr14 + qte15 * pr15 + qte16 * pr16
        End If

        If lbl1.Text <> "" And lbl9.Text <> "" Then
            res1 = TextBoxRes1.Text
            res2 = TextBoxRes2.Text
            TextBoxPrix.Text = res1 + res2
        End If
        If lbl1.Text <> "" And lbl9.Text = "" Then
            res1 = TextBoxRes1.Text
            TextBoxPrix.Text = res1
        End If
        If lbl1.Text = "" And lbl9.Text <> "" Then
            res2 = TextBoxRes2.Text
            TextBoxPrix.Text = res2
        End If
    End Sub

#Region "textchanged"

    Private Sub lbl101_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl101.TextChanged
        If lbl101.Text = "" Then
            qte1 = 0
        Else
            qte1 = lbl101.Text
        End If

    End Sub

    Private Sub lbl102_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl102.TextChanged
        pr1 = CDec(Val(lbl102.Text))
    End Sub

    Private Sub lbl201_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl201.TextChanged
        If lbl201.Text = "" Then
            qte2 = 0
        Else
            qte2 = lbl201.Text
        End If
    End Sub

    Private Sub lbl202_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl202.TextChanged
        pr2 = CDec(Val(lbl202.Text))
    End Sub

    Private Sub lbl301_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl301.TextChanged
        If lbl301.Text = "" Then
            qte3 = 0
        Else
            qte3 = lbl301.Text
        End If
    End Sub

    Private Sub lbl302_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl302.TextChanged
        pr3 = CDec(Val(lbl302.Text))
    End Sub

    Private Sub lbl401_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl401.TextChanged
        If lbl401.Text = "" Then
            qte4 = 0
        Else
            qte4 = lbl401.Text
        End If
    End Sub

    Private Sub lbl402_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl402.TextChanged
        pr4 = CDec(Val(lbl402.Text))
    End Sub

    Private Sub lbl501_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl501.TextChanged
        If lbl501.Text = "" Then
            qte5 = 0
        Else
            qte5 = lbl501.Text
        End If
    End Sub

    Private Sub lbl502_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl502.TextChanged
        pr5 = CDec(Val(lbl502.Text))
    End Sub

    Private Sub lbl601_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl601.TextChanged
        If lbl601.Text = "" Then
            qte6 = 0
        Else
            qte6 = lbl601.Text
        End If
    End Sub

    Private Sub lbl602_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl602.TextChanged
        pr6 = CDec(Val(lbl602.Text))
    End Sub

    Private Sub lbl701_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl701.TextChanged
        If lbl701.Text = "" Then
            qte7 = 0
        Else
            qte7 = lbl701.Text
        End If
    End Sub

    Private Sub lbl702_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl702.TextChanged
        pr7 = CDec(Val(lbl702.Text))
    End Sub

    Private Sub lbl801_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl801.TextChanged
        If lbl801.Text = "" Then
            qte8 = 0
        Else
            qte8 = lbl801.Text
        End If
    End Sub

    Private Sub lbl802_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl802.TextChanged
        pr8 = CDec(Val(lbl802.Text))
    End Sub


    Private Sub lbl91_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl91.TextChanged
        If lbl91.Text = "" Then
            qte9 = 0
        Else
            qte9 = lbl91.Text
        End If
    End Sub

    Private Sub lbl92_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl92.TextChanged
        pr9 = CDec(Val(lbl92.Text))
    End Sub

    Private Sub lbl1001_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl1001.TextChanged
        If lbl1001.Text = "" Then
            qte10 = 0
        Else
            qte10 = lbl1001.Text
        End If

    End Sub

    Private Sub lbl1002_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl1002.TextChanged
        pr10 = CDec(Val(lbl1002.Text))
    End Sub

    Private Sub lbl111_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl111.TextChanged
        If lbl111.Text = "" Then
            qte11 = 0
        Else
            qte11 = lbl111.Text
        End If
    End Sub

    Private Sub lbl112_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl112.TextChanged
        pr11 = CDec(Val(lbl112.Text))
    End Sub

    Private Sub lbl121_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl121.TextChanged
        If lbl121.Text = "" Then
            qte12 = 0
        Else
            qte12 = lbl121.Text
        End If
    End Sub

    Private Sub lbl122_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl122.TextChanged
        pr12 = CDec(Val(lbl122.Text))
    End Sub

    Private Sub lbl131_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl131.TextChanged
        If lbl131.Text = "" Then
            qte13 = 0
        Else
            qte13 = lbl131.Text
        End If
    End Sub

    Private Sub lbl132_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl132.TextChanged
        pr13 = CDec(Val(lbl132.Text))
    End Sub

    Private Sub lbl141_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl141.TextChanged
        If lbl141.Text = "" Then
            qte14 = 0
        Else
            qte14 = lbl141.Text
        End If
    End Sub

    Private Sub lbl142_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl142.TextChanged
        pr14 = CDec(Val(lbl142.Text))
    End Sub

    Private Sub lbl151_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl151.TextChanged
        If lbl151.Text = "" Then
            qte15 = 0
        Else
            qte15 = lbl151.Text
        End If
    End Sub

    Private Sub lbl152_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl152.TextChanged
        pr15 = CDec(Val(lbl152.Text))
    End Sub

    Private Sub lbl161_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl161.TextChanged
        If lbl161.Text = "" Then
            qte16 = 0
        Else
            qte16 = lbl161.Text
        End If
    End Sub

    Private Sub lbl162_TextChanged(sender As System.Object, e As System.EventArgs) Handles lbl162.TextChanged
        pr16 = CDec(Val(lbl162.Text))
    End Sub

#End Region

#Region "Double CLIC"
    Private Sub lbl1_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl1.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl1.Text)
        lbl101.Text = ""
        lbl102.Text = ""
        macnx.Se_Connecter_MySqlServer()
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl1.Text = ""
    End Sub


    Private Sub lbl2_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl2.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl2.Text)
        lbl201.Text = ""
        lbl202.Text = ""
        macnx.Se_Connecter_MySqlServer()
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl2.Text = ""
    End Sub

    Private Sub lbl3_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl3.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl3.Text)
        lbl301.Text = ""
        lbl302.Text = ""
        macnx.Se_Connecter_MySqlServer()
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl3.Text = ""
    End Sub

    Private Sub lbl4_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl4.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl4.Text)
        lbl401.Text = ""
        lbl402.Text = ""
        macnx.Se_Connecter_MySqlServer()
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl4.Text = ""
    End Sub

    Private Sub lbl5_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl5.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl5.Text)
        lbl501.Text = ""
        lbl502.Text = ""
        macnx.Se_Connecter_MySqlServer()
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl5.Text = ""
    End Sub

    Private Sub lbl6_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl6.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl6.Text)
        lbl601.Text = ""
        lbl602.Text = ""
        macnx.Se_Connecter_MySqlServer()
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl6.Text = ""
    End Sub

    Private Sub lbl7_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl7.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl7.Text)
        lbl701.Text = ""
        lbl702.Text = ""
        macnx.Se_Connecter_MySqlServer()
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl7.Text = ""
    End Sub

    Private Sub lbl8_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl8.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl8.Text)
        lbl801.Text = ""
        lbl802.Text = ""
        macnx.Se_Connecter_MySqlServer()
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl8.Text = ""
    End Sub

    Private Sub lbl9_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl9.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl9.Text)
        lbl91.Text = ""
        lbl92.Text = ""
        macnx.Se_Connecter_MySqlServer()
        Dim mat As Boolean = macnx.ExecuteScalar("SELECT isNeuf FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        If mat = False Then
            macnx.Executer_Requete_Action("UPDATE materielocass SET Quantiter= '" & qte9 & "' WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")

        End If

        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl9.Text = ""
    End Sub

    Private Sub lbl10_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl10.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl10.Text)
        lbl101.Text = ""
        lbl102.Text = ""
        macnx.Se_Connecter_MySqlServer()

        Dim mat As Boolean = macnx.ExecuteScalar("SELECT isNeuf FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        If mat = False Then
            macnx.Executer_Requete_Action("UPDATE materielocass SET Quantiter= '" & qte10 & "' WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")

        End If
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl10.Text = ""
    End Sub

    Private Sub lbl11_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl11.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl11.Text)
        lbl111.Text = ""
        lbl112.Text = ""
        macnx.Se_Connecter_MySqlServer()
        Dim mat As Boolean = macnx.ExecuteScalar("SELECT isNeuf FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        If mat = False Then
            macnx.Executer_Requete_Action("UPDATE materielocass SET Quantiter= '" & qte11 & "' WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")

        End If
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl11.Text = ""
    End Sub

    Private Sub lbl12_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl12.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl12.Text)
        lbl112.Text = ""
        lbl122.Text = ""
        macnx.Se_Connecter_MySqlServer()
        Dim mat As Boolean = macnx.ExecuteScalar("SELECT isNeuf FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        If mat = False Then
            macnx.Executer_Requete_Action("UPDATE materielocass SET Quantiter= '" & qte12 & "' WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")

        End If
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl12.Text = ""
    End Sub

    Private Sub lbl13_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl13.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl13.Text)
        lbl131.Text = ""
        lbl132.Text = ""
        macnx.Se_Connecter_MySqlServer()
        Dim mat As Boolean = macnx.ExecuteScalar("SELECT isNeuf FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        If mat = False Then
            macnx.Executer_Requete_Action("UPDATE materielocass SET Quantiter= '" & qte13 & "' WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")

        End If
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl13.Text = ""
    End Sub

    Private Sub lbl14_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl14.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl14.Text)
        lbl141.Text = ""
        lbl142.Text = ""
        macnx.Se_Connecter_MySqlServer()
        Dim mat As Boolean = macnx.ExecuteScalar("SELECT isNeuf FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        If mat = False Then
            macnx.Executer_Requete_Action("UPDATE materielocass SET Quantiter= '" & qte14 & "' WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")

        End If
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl14.Text = ""
    End Sub

    Private Sub lbl15_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl15.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl15.Text)
        lbl151.Text = ""
        lbl152.Text = ""
        macnx.Se_Connecter_MySqlServer()
        Dim mat As Boolean = macnx.ExecuteScalar("SELECT isNeuf FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        If mat = False Then
            macnx.Executer_Requete_Action("UPDATE materielocass SET Quantiter= '" & qte15 & "' WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")

        End If
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl15.Text = ""
    End Sub

    Private Sub lbl16_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lbl16.DoubleClick
        Dim a As String
        a = macnx.RemplaceCoteParVide(lbl16.Text)
        lbl161.Text = ""
        lbl162.Text = ""
        macnx.Se_Connecter_MySqlServer()
        Dim mat As Boolean = macnx.ExecuteScalar("SELECT isNeuf FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        If mat = False Then
            macnx.Executer_Requete_Action("UPDATE materielocass SET Quantiter= '" & qte16 & "' WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")

        End If
        macnx.Executer_Requete_Action("DELETE FROM travauxeffectues WHERE ( idIntervention = " & TextBoxIdIntervention.Text & " ) and (NomTravaux = '" & a & "' )")
        macnx.Se_Deconnecter_MySqlServer()
        lbl16.Text = ""
    End Sub
#End Region

End Class